package com.ynny.map01.example01;

import java.util.*;

public class ProvinceMapTest {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        HashMap<String, List<String>> map = new HashMap<>();

        List<String> list = new ArrayList<>();

        list.add("昆明");
        list.add("曲靖");

        List<String> list2 = new ArrayList<>();

        list2.add("武汉");
        list2.add("襄阳");

        map.put("云南",list);
        map.put("湖北",list2);

//        System.out.println(map);
        //获取所有的  key 即为所有的省份
        Set<String> set = map.keySet();
        //循环遍历显示
        for (String s : set) {
            System.out.print(s + "\t");
        }
        //换行
        System.out.println();
        System.out.println("请输入省份");
        String info = scanner.next();

        //通过输入的省份 即为key 获取 省份对应的城市 value
        List<String> strings = map.get(info);
        //查看list集合中所有的城市
        System.out.println(strings);

        System.out.println("请选择市级");
        String city = scanner.next();
        System.out.println(city + "信息登记成功！");

    }
}
